package com.cyh.testdesignpattern.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

//信息工程学院用数组存储专业
public class TInfoCollege implements TCollege {
    List<TDepartment> tDepartments = new ArrayList<>();

    public TInfoCollege() {
        addTDpartment("信息", "信息44");
        addTDpartment("通信", "通信55");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addTDpartment(String name, String desc) {
        TDepartment tDepartment = new TDepartment(name, desc);
        tDepartments.add(tDepartment);
    }

    @Override
    public Iterator createIterator() {
        return new InfoCollegeIterator(tDepartments);
    }
}
